package com.cv.platform.controller.audit.report;

import com.cv.framework.common.pojo.PageResult;
import com.cv.framework.common.pojo.Result;
import com.cv.framework.role.core.annotations.RolePermit;
import com.cv.platform.controller.audit.report.vo.AuditReportPageReqVO;
import com.cv.platform.controller.audit.report.vo.AuditReportRespVO;
import com.cv.platform.controller.platform.report.vo.CvReportSaveReqVO;
import com.cv.platform.service.report.CvReportService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static com.cv.framework.common.pojo.Result.success;

/**
 * 客服审核平台 - 举报控制层
 *
 * @author Charles_XDXD
 */
@Tag(name = "客服审核平台 - 举报控制层")
@RestController
@RequestMapping("/platform/report")
public class AuditReportController {

    @Resource
    private CvReportService cvReportService;

    @PutMapping("audit")
    @Operation(summary = "审核举报")
    @RolePermit(values = "customer_service")
    public Result<Void> auditReport(@RequestBody CvReportSaveReqVO reqVO) {
        cvReportService.saveReport(reqVO);
        return success();
    }

    @GetMapping("auditReportPage")
    @Operation(summary = "分页查询举报")
    @RolePermit(values = "customer_service")
    public Result<PageResult<AuditReportRespVO>> getAuditReportPage(AuditReportPageReqVO reqVO) {
        return success(cvReportService.getReportPage(reqVO));
    }

}
